//
//  CartShopItemTableViewCell.swift
//  StoryDemo
//
//  Created by mac on 2019/7/12.
//  Copyright © 2019年 zhkj. All rights reserved.
//

import UIKit

class CartShopItemTableViewCell: UITableViewHeaderFooterView {

    var shopcartHeaderViewBlock:((_ isSelected:Bool) -> Void)?
    
    var brandModel : ShopBean! {
        didSet{
//            if (brandModel.Shop[0].ShopLogo) != ""{
//                self.iv_shoplogo.setImage(path: URL.init(string: (brandModel.Shop[0].ShopLogo)!)!)
//            }
            self.lb_shopname.text = brandModel.Shop[0].ShopName
            self.btn_check.isSelected = brandModel.isSelected
        }
    }
    @IBOutlet weak var uv_check: UIView!
    @IBOutlet weak var btn_check: UIButton!
    @IBOutlet weak var iv_shoplogo: UIImageView!
    @IBOutlet weak var lb_shopname: UILabel!
    @IBOutlet weak var lb_getcoupon: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        btn_check.setImage(UIImage(named:"circle"), for: .normal)
        btn_check.setImage(UIImage(named:"yuangou"), for: .selected)
//        btn_check.addTarget(self, action: #selector(check(sender:)), for: UIControl.Event.touchUpInside)
        btn_check.addOnClickListener(target: self, action: #selector(check))
        uv_check.addOnClickListener(target: self, action: #selector(check))
    }
    @objc func check(){
        btn_check.isSelected = !btn_check.isSelected
        if shopcartHeaderViewBlock != nil{
            shopcartHeaderViewBlock!(btn_check.isSelected)
        }
    }
//    override var frame: CGRect {
//        get {
//            return super.frame
//        }
//        set {
//            var frame = newValue
//            frame.origin.x += 10
//            frame.size.width -= 2 * 10
//            super.frame = frame
//        }
//    }
    
}
